package com.mpdbailey.cleverdicandroid;

import com.pigdogbay.androidutils.mvp.IAdModel;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;


public class DebugActivity extends Activity {

	CheckBox _ChBxDisableAds;
	TextView _TextLog;
	AppData _AppData;
	IAdModel _AdModel;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_debug);
		_AppData = new AppData(this);
		_AdModel = _AppData.createAdModel();
		_ChBxDisableAds = (CheckBox) findViewById(R.id.dbgChkBxDisableAds);
		_TextLog = (TextView) findViewById(R.id.dbgTxtLog); 
		wireUpControls();
		_ChBxDisableAds.setChecked(_AdModel.getDisableAds());
		_TextLog.setText("");
	}
	
	private void wireUpControls()
	{
		_ChBxDisableAds.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				_AdModel.setDisableAds(isChecked);
			}
		});
		
	}
	void log(String msg)
	{
		_TextLog.append("\n");
		_TextLog.append(msg);
	}
	void alert(String message) {
		AlertDialog.Builder bld = new AlertDialog.Builder(this);
		bld.setMessage(message);
		bld.setNeutralButton(getString(R.string.ok), null);
		bld.create().show();
	}
}
